import axios from '../axios'

/*
 * 用户管理模块
 */

// 获取用户列表
export const getList = (data) => {
  console.log(data)
  if (data.keyWords === '') {
    return axios({
      url: 'user/get',
      method: 'get',
      params: {
        limit: data.limit,
        page: data.page
      } 
    })
  } else {
    return axios({
      url: 'user/get',
      method: 'get',
      params: {
        limit: data.limit,
        page: data.page,
        keyWords: data.keyWords,
        searchType: data.searchType
      } 
    })
  }

}
// 修改用户
export const updateUser = (data) => {
  return axios({
    url: 'user/changeStatus',
    method: 'post',
    data
  })
}
// 删除用户
export const delUser = (data) => {
  return axios({
    url: 'user/delUser',
    method: 'get',
    params: {
      userId: data
    }
  })
}
// 添加用户
export const addUser = (data) => {
  return axios({
    url: 'user/addUser',
    method: 'post',
    data
  })
}

// 获取在线用户
export const getOnlineUser = () => {
  return axios({
    url: 'user/onlineUser',
    method: 'get'
  })
}


// 修改密码
export const updatePassword = (data) => {
  return axios({
    url: 'user/updatePassword',
    method: 'post',
    data
  })
}

// 踢在线用户
export const kickoutOnlineUser = (data) => {
  return axios({
    url: 'user/kickoutUser',
    method: 'get',
    params: {
      sessionId: data
    }
  })
}
// 踢在线用户
export const kickoutOnlineUserMieba = () => {
  return axios({
    url: 'user/kickoutOnlineUserMieba',
    method: 'get'
  })
}

